Creating and Drawing a Curve
QuickDraw GX provides three common methods to create and draw a curve:
The first method is the simplest. You can draw a curve with a single
- You can draw a curve using the
GXDrawCurve
function.- You can create a curve shape using the
GXNewCurve
function and draw the curve shape using theGXDrawShape
function.- You can create a curve shape using the
GXNewShape
function, set the geometry of the curve shape using theGXSetCurve
function, and draw
the shape using theGXDrawShape
function.
function call:
GXDrawCurve(ff(40), ff(120), ff(100), ff(0), ff(200), ff(120));(The parameters to theGXDrawCurve
function specify the coordinates of the curve. The section "Setting the Geometry of the Curve" on page 45 explains these coordinates and the purpose of theff
macro in detail.)The function call results in the curve shown in Figure 2-1.
A second way to draw the same curve is to create a curve shape using the
GXNewCurve
function and then draw the curve shape using theGXDrawShape
function. Here is the code:
shape myCurve; myCurve = GXNewCurve(ff(40), ff(120), ff(100), ff(0), ff(200), ff(120)); GXDrawShape(myCurve);The following sections in this chapter use the third method; they show how you can create a curve shape using theGXNewShape
function, modify the curve shape, draw the curve shape to a Macintosh window, print the curve shape, and examine the curve shape using the GraphicsBug debugger.